#ifndef __INVADER_FONT_H__
#define __INVADER_FONT_H__

#include <map>

#include <QPixmap>

class QString;
class QChar;

/**
 * Privides access to a bitmapped font.  The letters of the font should all be
 * contained in the directory provided and names x.bmp where is x is the
 * letter the bitmap is of.  This class is implemented as a singleton class.
 */
class InvaderFont
{
public:
  /**
   * @returns a reference to the singleton InvaderFont class
   */
  static const InvaderFont & instance ();
  /**
   * Destroys the singleton class instance
   */
  static void destroy ();

  /**
   * @returns a pixmap of the character c
   */
  const QPixmap & operator[] (const QChar &c) const;

protected:
  /**
   * The constructors are protected because this class is a singleton
   */
  InvaderFont ();
  /**
   * The constructors are protected because this class is a singleton
   */
  InvaderFont (const QString &dir);

private:
  QPixmap _unknownGlyph;
  std::map<char, QPixmap> _glyphs;

  static InvaderFont *_instance;
};

#endif
